package com.javalab._7thread._5ThreadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class _02FixThreadPool {
    public static void main(String[] args) {
        ExecutorService executor = Executors.newFixedThreadPool(3);
        executor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程1");
            }
        });

        executor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程2");
            }
        });

        executor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程3");
            }
        });

        executor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程4");
            }
        });

        executor.shutdown();
    }
}
